package study.函数式接口.谓词复合;

import study.User;
import study.函数式接口.Apple;
import study.函数式接口.RedApple;

import java.util.function.Predicate;

/**
 * @Author 金贵权
 * @Date 2023/6/16 14:24
 **/
public class Demo01 {
    public static void main(String[] args) {
        RedApple redApple = new RedApple(12);
        Predicate<Apple> predicate = redApple.negate();
        boolean test = predicate.test(new RedApple("苹果", 12, "黑色"));
        System.out.println(test);

        Predicate<Apple> test1 = redApple.and(a -> a.getWeight() > 150).or(b -> "黑色".equals(b.getColor()));
        boolean test2 = test1.test(new RedApple("苹果", 12, "黑色"));
        System.out.println(test2);
    }
}
